package com.corning.patient.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.corning.patient.entity.InquiryRecordEntity;
import com.corning.patient.service.InquiryRecordService;
import com.corning.common.utils.PageUtils;
import com.corning.common.utils.R;



/**
 * 
 *
 * @author wtt
 * @email 1239115389@qq.com
 * @date 2022-03-20 15:16:34
 */
@RestController
@RequestMapping("patient/inquiryrecord")
public class InquiryRecordController {
    @Autowired
    private InquiryRecordService inquiryRecordService;

    /**
     * 列表
     */
    @RequestMapping("/list")

    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = inquiryRecordService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{inquiryId}")

    public R info(@PathVariable("inquiryId") Integer inquiryId){
		InquiryRecordEntity inquiryRecord = inquiryRecordService.getById(inquiryId);

        return R.ok().put("inquiryRecord", inquiryRecord);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")

    public R save(@RequestBody InquiryRecordEntity inquiryRecord){
		inquiryRecordService.save(inquiryRecord);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody InquiryRecordEntity inquiryRecord){
		inquiryRecordService.updateById(inquiryRecord);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")

    public R delete(@RequestBody Integer[] inquiryIds){
		inquiryRecordService.removeByIds(Arrays.asList(inquiryIds));

        return R.ok();
    }

}
